package com.thd.framework.basic;


import com.thd.framework.basic.model.Message;
import com.thd.framework.basic.utils.MessageUtils;

/**
 * com.thd.framework.MyException
 *
 * @author: wanglei62
 * @DATE: 2020/9/15 16:57
 **/
public class BasicException extends RuntimeException{
    private String code;
    private String msg;
    public BasicException(){
        super();
    }

    public BasicException(String code, String msg){
        this.code = code;
        this.msg = msg;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public static void throwMyExceptionForI18n(String message,Object... obj){
        throw new BasicException(Message.ERROR_DEFAULT_CODE, MessageUtils.message(message,obj));
    }
    public static void throwMyException(String message){
        throw new BasicException(Message.ERROR_DEFAULT_CODE,message);
    }


}
